#include "stdafx.h"
#include "Formula.h"
#include "Operator.h"
#include "InstanceTouch.h"

DECL_INSTANCE_TOUCH(ETouch_Formual);

struct  FormulaDefReflectionRegister
{
	FormulaDefReflectionRegister()
	{
		REGISTER_REFLECTION_MEMBER(Formula,m_iID,INVALID_ID).Editor_SetAsPrimaryKey();
		REGISTER_REFLECTION_MEMBER(Formula,m_sDisplayName,std::string("DefaultName")).Editor_SetAsDisplayName();
		REGISTER_REFLECTION_MEMBER(Formula,m_iOperator,INVALID_ID).Editor_SetAsForeignKey(eDefGroup_Default,eDefaultDef_Operator);
		REGISTER_REFLECTION_MEMBER(Formula,m_eParam0,ECalBaselValueType_Zero).Editor_SetAsEnumation<ECalBaselValueType>("Params");
		REGISTER_REFLECTION_MEMBER(Formula,m_eParam1,ECalBaselValueType_Zero).Editor_SetAsEnumation<ECalBaselValueType>("Params");
		REGISTER_REFLECTION_MEMBER(Formula,m_eParam2,ECalBaselValueType_Zero).Editor_SetAsEnumation<ECalBaselValueType>("Params");
		REGISTER_REFLECTION_MEMBER(Formula,m_eParam3,ECalBaselValueType_Zero).Editor_SetAsEnumation<ECalBaselValueType>("Params");
		REGISTER_REFLECTION_MEMBER(Formula,m_fValue0,double(0.f)).Editor_SetAsRaw("AbsValues");
		REGISTER_REFLECTION_MEMBER(Formula,m_fValue1,double(0.f)).Editor_SetAsRaw("AbsValues");
		REGISTER_REFLECTION_MEMBER(Formula,m_fValue2,double(0.f)).Editor_SetAsRaw("AbsValues");
		REGISTER_REFLECTION_MEMBER(Formula,m_fValue3,double(0.f)).Editor_SetAsRaw("AbsValues");

		GlobalClassManager::Instance().RegisterClass(Formula::s_GetReflection(),eDefaultDef_Formula);
		GlobalDefManager::Instance().RegisterDefManger(&FormulaManager::Instance());
	}
}__FormulaDefReflectionRegister;

rewrite  void Formula::OnArchieveReaded()
{
	m_pOperator=OperatorManager::Instance().LookupItem(m_iOperator);
}
